<template>
    <div>
        <a-descriptions
                v-for="(item, i) in this.data.owners"
                :key="'des' + i"
                bordered
                :column="{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }"
                size="small"

        >
            <a-descriptions-item label="业主照片" :v-once="getImg(item.imgkey)">
                <img :alt="item.name" style="width: 100px" :src="imageUrl" />
            </a-descriptions-item>
            <a-descriptions-item label="业主">
                {{item.name}}
            </a-descriptions-item>
            <a-descriptions-item label="是否在住">
                {{item.instate ? '是':'否'}}
            </a-descriptions-item>
            <a-descriptions-item label="身份证">
                {{item.idcard}}
            </a-descriptions-item>
            <a-descriptions-item label="性别">
                {{item.sex == 'male'?'男':'女'}}
            </a-descriptions-item>
            <a-descriptions-item label="民族">
                {{item.people}}
            </a-descriptions-item>
            <a-descriptions-item label="出生日期">
                {{item.birthday}}
            </a-descriptions-item>
            <a-descriptions-item label="地址">
                {{item.address}}
            </a-descriptions-item>
            <a-descriptions-item label="手机">
                {{item.cellphone}}
            </a-descriptions-item>
            <a-descriptions-item label="电话">
                {{item.telphone}}
            </a-descriptions-item>
            <a-descriptions-item label="紧急联系电话">
                {{item.importphone}}
            </a-descriptions-item>
            <a-descriptions-item label="联系地址">
                {{item.contactaddress}}
            </a-descriptions-item>
            <a-descriptions-item label="工作单位">
                {{item.company}}
            </a-descriptions-item>
            <a-descriptions-item label="职业">
                {{item.workname}}
            </a-descriptions-item>
            <a-descriptions-item label="职位">
                {{item.worklevel}}
            </a-descriptions-item>
            <a-descriptions-item label="业主标签">
                <div v-for="(item, i) in item.tags" :key="'tag' + i">
                    {{item.tag}}
                    <br />
                </div>
            </a-descriptions-item>
        </a-descriptions>
    </div>
</template>

<script>
    import {doGet, doPostUnlencoded} from "@/utils/requestUtil";
    export default {
        name: "propertydetail",
        data() {
            return {
                data: [],
                imageUrl: '',
            }
        },
        beforeMount() {
            doGet("/prjproperty/api/property/" + this.$route.params.detailid, null).then((res) => {

                if (res.success) {
                    console.info(res)
                    this.data = res.data;
                }
            }).catch((err) => {
                console.info(err);
            })
        },
        methods: {
            async getImg(key) {
                let params = {
                    filename: key,
                    bucket: 'fygproperty'
                }
                console.info(params);
                doPostUnlencoded("/enroll/oss/getobjwithbucket", params).then((res) => {
                    console.info(res);
                    if (res.result) {
                        this.imageUrl = res.data;
                    }
                }).catch((err) => {
                    console.info(err);
                });
            }
        }
    }
</script>

<style scoped>

</style>
